import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:get/get.dart';

class LoadingDialog extends StatelessWidget {
  String? message;

  LoadingDialog({this.message}) {
    if (this.message == null) {
      this.message = 'loading'.tr;
    }
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async => false,
      child: SimpleDialog(
        children: [
          Container(
            height: 80,
            child: Row(
              children: [
                Expanded(
                  child: SizedBox(),
                  flex: 1,
                ),
                SpinKitSquareCircle(
                  color: Colors.blue,
                ),
                Expanded(
                  child: SizedBox(),
                  flex: 1,
                ),
                Expanded(
                  child: Text(
                    message!,
                    style: TextStyle(fontSize: 20),
                  ),
                  flex: 3,
                ),
              ],
            ),
          )
        ],
      ),
    );
  }
}
